import java.awt.Point;

public class MenuStructure {
	Node headNode;

	Node currNode;

	public MenuStructure(){
	}

	public Node getHeadNode(){
		return headNode;
	}
	public void setHeadNode(Node node){
		headNode = node;
	}
	
	public Node getCurrentNode(){
		return currNode;
	}
	
	public void setCurrentNode(Node node){
		currNode = node;
	}

	public void moveToLeft(){
		if(currNode.getLeft()!=null){
			currNode.getLeft().setLastVisited(currNode);
			currNode = currNode.getLeft();
		}

	}
	public void moveToRight(){
		if(currNode.getRight()!=null){
			currNode.getRight().setLastVisited(currNode);
			currNode = currNode.getRight();
		}
	}

	public void moveToUp(){
		if(currNode.getUp()!=null){
			currNode.getUp().setLastVisited(currNode);
			currNode = currNode.getUp();
		}
	}
	public void moveToDown(){
		if(currNode.getDown()!=null){
			currNode.getDown().setLastVisited(currNode);
			currNode = currNode.getDown();
		}
	}

	
	
}

class Node{  //basically a linked-list
	Node up ,down,left,right; //all null by default
	Node lastVisited;
	String name;

	//specifies the center of where the 'Currently Selected' picture should go
	Point selectorLocation;
	

	public Node(String name, Point selectorLocation){
		this.name = name;
		this.selectorLocation = selectorLocation;
	}
	public void setUp(Node up){
		this.up = up;
	}
	public void setDown(Node down){
		this.down = down;
	}

	public void setLeft(Node left){
		this.left = left;
	}

	public void setRight(Node right){
		this.right = right;
	}

	public void setLastVisited(Node lastVisited){
		this.lastVisited = lastVisited;
	}
	public Node getUp() {
		return up;
	}
	public Node getDown() {
		return down;
	}
	public Node getLeft() {
		return left;
	}
	public Node getRight() {
		return right;
	}
	public Node getLastVisited() {
		return lastVisited;
	}
	public String getName() {
		return name;
	}
	public String toString(){
		return getName();
	}
	
	public Point getSelectorLocation( ){
		return selectorLocation;
	}


}